package net.zjitc.servlet.region;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author 赵静静
 * @Date 2023/5/25 16:28
 */
@WebServlet(name = "TestCServlet",urlPatterns = "/toRedirect")
public class CServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       //重定向的地址，默认是重定向到本项目，如果想重定向到其它的网站，需要加http协议
        //重定向的地址，是定向后的地址

        response.sendRedirect("https://www.baidu.com");
    }
}
